<?php

declare(strict_types=1);

namespace Api\InterfaceApi\v1\Work;

use Api\Request\v1\Work\EmployeeRequest;
use Api\Service\v1\Work\EmployeeApiService;
use Hyperf\Di\Annotation\Inject;
use Mine\MineApi;

/**
 * 企微成员
 */
class EmployeeApi extends MineApi
{
    #[Inject]
    protected EmployeeApiService $service;

    /**
     * 获取部门列表
     * @param EmployeeRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function getDeptList(EmployeeRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getDeptList($request->all()));
    }

    /**
     * 获取部门成员列表
     * @param EmployeeRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function getUserListByDeptId(EmployeeRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getUserListByDeptId($request->all()));
    }
}